package com.example.opengldemo;

import android.opengl.GLES20;

public class Mallet {

    private static final int POSITION_COMPONENT_COUNT=2;
    private static final int COLOR_COMPONENT_COUNT =3;
    private static final int STRIDE = (POSITION_COMPONENT_COUNT+COLOR_COMPONENT_COUNT)*4;

    private VertexArray vertexArray;

    private static final float[] VERTEX_DATA ={
            0f,-0.5f,1f,0f,1f,
            0f,0.5f,0f,1f,0f
    };

    public Mallet(){
        vertexArray = new VertexArray(VERTEX_DATA);
    }

    public void bindData(ColorShaderProgram colorShaderProgram){

        vertexArray.setVertexAttribPointer(0,colorShaderProgram.getPositionAttributeLocation(),POSITION_COMPONENT_COUNT,STRIDE);

        vertexArray.setVertexAttribPointer(POSITION_COMPONENT_COUNT,colorShaderProgram.getColorAttributeLocation(),COLOR_COMPONENT_COUNT,STRIDE);
    }

    public void draw(){
        GLES20.glDrawArrays(GLES20.GL_POINTS,0,2);
    }

}
























